"""
基础AI服务抽象层
定义AI服务的接口规范和基础功能
"""

import logging
from abc import ABC, abstractmethod

logger = logging.getLogger(__name__)

class BaseAIService(ABC):
    """AI服务接口的抽象基类 (Abstract Base Class for AI Service Interface)."""

    def __init__(self, service_name: str = None):
        """初始化基础服务"""
        self.service_name = service_name or self.__class__.__name__

    @abstractmethod
    async def analyze(self, image_bytes: bytes) -> str:
        """
        分析图片并返回文本结果 (Analyze image and return text result).

        :param image_bytes: 图片的字节数据 (Image content in bytes).
        :return: 分析出的文本字符串 (Analyzed text as a string).
        """
        pass

    def get_service_info(self) -> dict:
        """
        获取服务基本信息 (Get basic service information).

        :return: 服务信息字典 (Service information dict).
        """
        return {
            'service_type': self.__class__.__name__,
            'status': 'active'
        }
